package org.example.spring.ioc;

import org.example.spring.ioc.bean.Person;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.util.Map;

@SpringBootApplication
public class ConditionalTest {
    public static void main(String[] args) {
        ConfigurableApplicationContext ioc = SpringApplication.run(ConditionalTest.class, args);
        Map<String, Person>  beans = ioc.getBeansOfType(Person.class);
        System.out.println(beans);
        //获取环境信息,拿到环境变量
        ConfigurableEnvironment environment = ioc.getEnvironment();
        String property = environment.getProperty("OS");
        System.out.println(property);

    }
}
